package thread;

public class CurrentThreadDemo
{
    public static void main(String[] args)
    {
        Thread a = Thread.currentThread();
        System.out.println(a);
        doSome();

        Thread t1 = new Thread("t1")
        {
            @Override
            public void run()
            {
                doSome();
            }
        };
        t1.start();
        System.out.println(a.getContextClassLoader());
        System.out.println(a.getId());
        System.out.println(a.getPriority());   // 优先级
        System.out.println(a.getName());
        System.out.println(a.isDaemon());


    }

    public static void doSome()
    {
        Thread thread = Thread.currentThread();
        System.out.println("doSome() = " + thread);
        System.out.println(thread.getId());
    }
}
